// custom-tab-bar.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    active: 0,
    list: [
      {
        "url": "/pages/home/home",
        "icon": "wap-home-o",
        "text": "首页"
      },
      {
        "url": "/pages/index/index",
        "icon": "orders-o",
        "text": "用户"
      },
      {
        "url": "/pages/list/list",
        "icon": "points",
        "text": "列表"
      }
    ]
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      console.log(e,'e')
      this.setData({ active: e.detail });
      wx.switchTab({
        url: this.data.list[e.detail].url
      });
   },
   init() {
       const page = getCurrentPages().pop();
       this.setData({
      　  active: this.data.list.findIndex(item => item.url === `/${page.route}`)
       });
      }
  }
})
